<template>
	<w-container :showCopyright="false" :hasNav="false" :isTabPage="false" :loading="loading" id='product-details'>
		<view class="pa-16">
			<z-common-box v-if="info.draw_complete == 0" padding="18px 21px">
				<view class="font-size-14 font-color-666">结果暂未公布，敬请期待！</view>
			</z-common-box>
			<template v-else>
				<!-- <z-common-box padding="18px 21px" width="88%">
					<view class="font-size-14 font-color-theme_title">
						<text>在产生的 </text>
						<text class="font-w-bold ml-6 mr-6">{{info.total_num}}</text>
						<text>抽签码中，共有</text>
						<text class="font-color-theme ml-6 mr-6">{{info.success_user_num}}</text>
						<text>人中签！</text>
					</view>
				</z-common-box> -->
				<!-- <z-common-box padding="18px 12px" marginTop="30rpx">
					<view class="font-size-14 font-color-theme_title">
						<view class="flex flex-ai-center flex-js-sb">
							<text class="font-size-12 font-color-999">末尾位数</text>
							<text class="font-size-12 font-color-999">中签号码</text>
						</view>
						<view class="font-w-bold">
							<view class="flex flex-ai-center flex-js-sb mt-12">
								<text class="font-size-12">后3位</text>
								<text class="font-size-12">352、542、345</text>
							</view>
							<view class="flex flex-ai-center flex-js-sb mt-12">
								<text class="font-size-12">后4位</text>
								<text class="font-size-12">3122、5342、3435</text>
							</view>
							<view class="flex flex-ai-center flex-js-sb mt-12">
								<text class="font-size-12">后5位</text>
								<text class="font-size-12">43122、65342、13435</text>
							</view>
						</view>
					</view>
				</z-common-box> -->
				<view class="flex flex-dir-col flex-ai-center flex-js-center mt-32">
					<template v-if="!info.success_code.length">
						<image  src="/static/img/icon/draw_no.png" mode="widthFix" style="width: 225px;"></image>
						<text class="font-color-theme_title font-w-bold font-size-18">很遗憾，未中签！</text>
						<text class="font-color-999 mt-20 font-size-14">不要灰心，下次再试！</text>
					</template>
					<template v-else>
						<image  src="/static/img/icon/draw_yes.png" mode="widthFix" style="width: 225px;"></image>
						<text class="font-color-theme_title font-w-bold font-size-18">恭喜您，中签啦！</text>
						<view class="flex flex-w">
							<view v-for="(item,index) in info.success_code" :key="index" class="list_box font-size-14 mt-20 mr-10">{{item}}</view>
						</view>
					</template>
				</view>
			</template>
		</view>
	</w-container>	  
</template>

<script>
	import { qualification } from "@/api/draw/index.js"
	export default {
		data() {
			return {
				loading:true,
				info:{
					success_code:[]
				},
				form:{}
			}
		},
		onLoad({data}) {
			this.form = JSON.parse(data)
			this.getDetail()
		},
		beforeDestroy() {
			uni.removeStorageSync('drawResult')
		},
		methods: {
			getDetail(){
				qualification(this.form).then( res => {
					this.info = res.data
					this.loading = false
				}).catch( err => {})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: #f5f5f5;
	}
	.list_box {
		padding: 8rpx;		
		border-radius: 8rpx;
		@extend .bg_jb_theme;
		color: #fff;
	}
</style>
